Batch update Locations
curl --request POST \
--url https://{base_url_domain}/api/global/v1/inventory/warehouses/{id}/locations/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"onError": "continue",
"operation": "upsert",
"locations": [
{
"label": "RK07-R2-S1-L1",
"rack": {
"type": "Rack",
"id": 3
},
"slot_type": {
"type": "SlotType",
"id": 3
},
"keep_capacity_on_slot_type_change": false,
"priority": 2,
"tags": [
{
"type": "LocationTag",
"id": 4
}
]
}
]
}
'import requests
url = "https://{base_url_domain}/api/global/v1/inventory/warehouses/{id}/locations/batch"
payload = {
"onError": "continue",
"operation": "upsert",
"locations": [
{
"label": "RK07-R2-S1-L1",
"rack": {
"type": "Rack",
"id": 3
},
"slot_type": {
"type": "SlotType",
"id": 3
},
"keep_capacity_on_slot_type_change": False,
"priority": 2,
"tags": [
{
"type": "LocationTag",
"id": 4
}
]
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
onError: 'continue',
operation: 'upsert',
locations: [
{
label: 'RK07-R2-S1-L1',
rack: {type: 'Rack', id: 3},
slot_type: {type: 'SlotType', id: 3},
keep_capacity_on_slot_type_change: false,
priority: 2,
tags: [{type: 'LocationTag', id: 4}]
}
]
})
};
fetch('https://{base_url_domain}/api/global/v1/inventory/warehouses/{id}/locations/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{base_url_domain}/api/global/v1/inventory/warehouses/{id}/locations/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'onError' => 'continue',
'operation' => 'upsert',
'locations' => [
[
'label' => 'RK07-R2-S1-L1',
'rack' => [
'type' => 'Rack',
'id' => 3
],
'slot_type' => [
'type' => 'SlotType',
'id' => 3
],
'keep_capacity_on_slot_type_change' => false,
'priority' => 2,
'tags' => [
[
'type' => 'LocationTag',
'id' => 4
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{base_url_domain}/api/global/v1/inventory/warehouses/{id}/locations/batch"
payload := strings.NewReader("{\n \"onError\": \"continue\",\n \"operation\": \"upsert\",\n \"locations\": [\n {\n \"label\": \"RK07-R2-S1-L1\",\n \"rack\": {\n \"type\": \"Rack\",\n \"id\": 3\n },\n \"slot_type\": {\n \"type\": \"SlotType\",\n \"id\": 3\n },\n \"keep_capacity_on_slot_type_change\": false,\n \"priority\": 2,\n \"tags\": [\n {\n \"type\": \"LocationTag\",\n \"id\": 4\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{base_url_domain}/api/global/v1/inventory/warehouses/{id}/locations/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"onError\": \"continue\",\n \"operation\": \"upsert\",\n \"locations\": [\n {\n \"label\": \"RK07-R2-S1-L1\",\n \"rack\": {\n \"type\": \"Rack\",\n \"id\": 3\n },\n \"slot_type\": {\n \"type\": \"SlotType\",\n \"id\": 3\n },\n \"keep_capacity_on_slot_type_change\": false,\n \"priority\": 2,\n \"tags\": [\n {\n \"type\": \"LocationTag\",\n \"id\": 4\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{base_url_domain}/api/global/v1/inventory/warehouses/{id}/locations/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"onError\": \"continue\",\n \"operation\": \"upsert\",\n \"locations\": [\n {\n \"label\": \"RK07-R2-S1-L1\",\n \"rack\": {\n \"type\": \"Rack\",\n \"id\": 3\n },\n \"slot_type\": {\n \"type\": \"SlotType\",\n \"id\": 3\n },\n \"keep_capacity_on_slot_type_change\": false,\n \"priority\": 2,\n \"tags\": [\n {\n \"type\": \"LocationTag\",\n \"id\": 4\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"committed": 1,
"failed": 1,
"results": [
{
"resource": {
"type": "Location",
"id": 42,
"label": "RK07-R2-S1-L1"
},
"status": "committed",
"message": "<string>"
}
]
}{
"errors": [
{
"type": "parameters",
"message": "The supplied parameters are invalid."
}
]
}{
"errors": [
{
"type": "not_found",
"message": "The server could not find the requested resource."
}
]
}{
"errors": [
{
"type": "unable_to_process",
"message": "There was an error processing the request."
}
]
}Locations
Batch update Locations
Creates or updates a Location collection specified by a warehouse id path parameter and according to the request body.
POST
/
v1
/
inventory
/
warehouses
/
{id}
/
locations
/
batch
Batch update Locations
curl --request POST \
--url https://{base_url_domain}/api/global/v1/inventory/warehouses/{id}/locations/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"onError": "continue",
"operation": "upsert",
"locations": [
{
"label": "RK07-R2-S1-L1",
"rack": {
"type": "Rack",
"id": 3
},
"slot_type": {
"type": "SlotType",
"id": 3
},
"keep_capacity_on_slot_type_change": false,
"priority": 2,
"tags": [
{
"type": "LocationTag",
"id": 4
}
]
}
]
}
'import requests
url = "https://{base_url_domain}/api/global/v1/inventory/warehouses/{id}/locations/batch"
payload = {
"onError": "continue",
"operation": "upsert",
"locations": [
{
"label": "RK07-R2-S1-L1",
"rack": {
"type": "Rack",
"id": 3
},
"slot_type": {
"type": "SlotType",
"id": 3
},
"keep_capacity_on_slot_type_change": False,
"priority": 2,
"tags": [
{
"type": "LocationTag",
"id": 4
}
]
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
onError: 'continue',
operation: 'upsert',
locations: [
{
label: 'RK07-R2-S1-L1',
rack: {type: 'Rack', id: 3},
slot_type: {type: 'SlotType', id: 3},
keep_capacity_on_slot_type_change: false,
priority: 2,
tags: [{type: 'LocationTag', id: 4}]
}
]
})
};
fetch('https://{base_url_domain}/api/global/v1/inventory/warehouses/{id}/locations/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{base_url_domain}/api/global/v1/inventory/warehouses/{id}/locations/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'onError' => 'continue',
'operation' => 'upsert',
'locations' => [
[
'label' => 'RK07-R2-S1-L1',
'rack' => [
'type' => 'Rack',
'id' => 3
],
'slot_type' => [
'type' => 'SlotType',
'id' => 3
],
'keep_capacity_on_slot_type_change' => false,
'priority' => 2,
'tags' => [
[
'type' => 'LocationTag',
'id' => 4
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{base_url_domain}/api/global/v1/inventory/warehouses/{id}/locations/batch"
payload := strings.NewReader("{\n \"onError\": \"continue\",\n \"operation\": \"upsert\",\n \"locations\": [\n {\n \"label\": \"RK07-R2-S1-L1\",\n \"rack\": {\n \"type\": \"Rack\",\n \"id\": 3\n },\n \"slot_type\": {\n \"type\": \"SlotType\",\n \"id\": 3\n },\n \"keep_capacity_on_slot_type_change\": false,\n \"priority\": 2,\n \"tags\": [\n {\n \"type\": \"LocationTag\",\n \"id\": 4\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{base_url_domain}/api/global/v1/inventory/warehouses/{id}/locations/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"onError\": \"continue\",\n \"operation\": \"upsert\",\n \"locations\": [\n {\n \"label\": \"RK07-R2-S1-L1\",\n \"rack\": {\n \"type\": \"Rack\",\n \"id\": 3\n },\n \"slot_type\": {\n \"type\": \"SlotType\",\n \"id\": 3\n },\n \"keep_capacity_on_slot_type_change\": false,\n \"priority\": 2,\n \"tags\": [\n {\n \"type\": \"LocationTag\",\n \"id\": 4\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{base_url_domain}/api/global/v1/inventory/warehouses/{id}/locations/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"onError\": \"continue\",\n \"operation\": \"upsert\",\n \"locations\": [\n {\n \"label\": \"RK07-R2-S1-L1\",\n \"rack\": {\n \"type\": \"Rack\",\n \"id\": 3\n },\n \"slot_type\": {\n \"type\": \"SlotType\",\n \"id\": 3\n },\n \"keep_capacity_on_slot_type_change\": false,\n \"priority\": 2,\n \"tags\": [\n {\n \"type\": \"LocationTag\",\n \"id\": 4\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"committed": 1,
"failed": 1,
"results": [
{
"resource": {
"type": "Location",
"id": 42,
"label": "RK07-R2-S1-L1"
},
"status": "committed",
"message": "<string>"
}
]
}{
"errors": [
{
"type": "parameters",
"message": "The supplied parameters are invalid."
}
]
}{
"errors": [
{
"type": "not_found",
"message": "The server could not find the requested resource."
}
]
}{
"errors": [
{
"type": "unable_to_process",
"message": "There was an error processing the request."
}
]
}Authorizations
Body
application/json
An object conforming to the Inventory Warehouse Location schemas batch to be created or updated.
The value determining how errors are to be handled.
continueThe current entity will be rolled back and any remaining entities will continue to be processed.stopThe current entity will be rolled back and the request will stop processing any remaining entities.abortThe entire request will be rolled back.
Available options:
continue, stop, abort Response
No fatal client or server errors occurred. Check the response to see which items were updated successfully.
Was this page helpful?